package com.yixun.entity;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import java.util.Collection;
import java.util.Date;
import java.io.Serializable;

/**
 * 用户表,包含管理员和各级业务人员(YxSysUser)实体类
 *
 * @author lbx
 * @since 2021-06-01 09:45:23
 */
@Data
public class YxSysUser implements UserDetails {
    /**
     * 用户ID
     */
    private Long id;
    /**
     * 用户登录名
     */
    private String username;
    /**
     * 用户登录密码
     */
    private String password;
    /**
     * 微信openId
     */
    private String openId;
    /**
     * 手机号
     */
    private Long phone;
    /**
     * 部门Id
     */
    private Long deptId;
    /**
     * 状态 0、绑定；-1、未绑定
     */
    private Integer isBindToWeChat;
    /**
     * 状态 0、正常；-1、停用
     */
    private Integer status;
    /**
     * 真实姓名
     */
    private String realName;
    /**
     * 记录添加人员ID
     */
    private Long createUserId;
    /**
     * 添加时间 mysql自动添加
     */
    private Date createTime;
    /**
     * 记录更新人员ID
     */
    private Long updateUserId;
    /**
     * 更新时间 mysql自动更新
     */
    private Date updateTime;
    
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }
    @Override
    public boolean isAccountNonExpired() {
        return true;
    }
  
    
    @Override
    public boolean isAccountNonLocked() {
        return true;
    }
    
    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }
    
    @Override
    public boolean isEnabled() {
        return this.status == 0;
    }
}
